package com.jcms.cms.action.front.bind;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.jcms.cms.entity.parcel.Order;
import com.jcms.cms.entity.parcel.Parcel;


public class ParcelDetail {
	private double[] weight;
	private double[] length;
	private double[] width;
	private double[] height;
	private double[] price;
	private String[] itemsName;
	private String[] brand;
	private String[] models;
	private String[] origin;
	private String[] unitPrice;
	private String[] number;
	private String[] requirements;
	
	public Set<Parcel> bindParcels(Order order) {
		Set<Parcel> parcels = new HashSet<Parcel>();
		for(int i=0; i<weight.length; i++) {
			Parcel parcel = new Parcel();
			parcel.setBrand(brand[i]);
			parcel.setHeight(height[i]);
			parcel.setItemsName(itemsName[i]);
			parcel.setLength(length[i]);
			parcel.setModel(models[i]);
			parcel.setNumber(number[i]);
			parcel.setOrigin(origin[i]);
			parcel.setRequirements(requirements[i]);
			parcel.setUnitPrice(unitPrice[i]);
			parcel.setWeight(weight[i]);
			parcel.setWidth(width[i]);
			parcel.setOrder(order);
			parcel.setPrice(price[i]);
			parcels.add(parcel);
		}
		order.setParcels(parcels);
		return parcels;
	}
	
	public double[] getPrice() {
		return price;
	}

	public void setPrice(double[] price) {
		this.price = price;
	}

	public double[] getWeight() {
		return weight;
	}
	public void setWeight(double[] weight) {
		this.weight = weight;
	}
	public double[] getLength() {
		return length;
	}
	public void setLength(double[] length) {
		this.length = length;
	}
	public double[] getWidth() {
		return width;
	}
	public void setWidth(double[] width) {
		this.width = width;
	}
	public double[] getHeight() {
		return height;
	}
	public void setHeight(double[] height) {
		this.height = height;
	}
	public String[] getItemsName() {
		return itemsName;
	}
	public void setItemsName(String[] itemsName) {
		this.itemsName = itemsName;
	}
	public String[] getBrand() {
		return brand;
	}
	public void setBrand(String[] brand) {
		this.brand = brand;
	}
	public String[] getModels() {
		return models;
	}
	public void setModels(String[] models) {
		this.models = models;
	}
	public String[] getOrigin() {
		return origin;
	}
	public void setOrigin(String[] origin) {
		this.origin = origin;
	}
	public String[] getUnitPrice() {
		return unitPrice;
	}
	public void setUnitPrice(String[] unitPrice) {
		this.unitPrice = unitPrice;
	}
	public String[] getNumber() {
		return number;
	}
	public void setNumber(String[] number) {
		this.number = number;
	}
	public String[] getRequirements() {
		return requirements;
	}
	public void setRequirements(String[] requirements) {
		this.requirements = requirements;
	}
}
